<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<link  rel="stylesheet" type="text/css" th:href="@{/css/bootstrap.min.css}"/>
<link rel="stylesheet" type="text/css" th:href="@{/css/font-awesome.min.css}"/>
<head lang="en">
    <title>Messages : Create</title>
</head>
<body>
<div class="container">
    <div th:replace="fragments :: navbar"></div>
    <div class="float-right mt-2">
        <a class="btn btn-primary btn-sm" th:href="@{/}" href="messages.html"> Messages </a>
    </div>
    <h4 class="float-left mt-2">Messages : Create</h4>
    <div class="clearfix"></div>
    <form id="messageForm" th:action="@{/add}" th:object="${message}" action="#" method="post">
        <div th:if="${#fields.hasErrors('*')}" class="alert alert-danger" role="alert">
            <p th:each="error : ${#fields.errors('*')}" class="m-0" th:text="${error}">Validation error</p>
        </div>
        <input type="hidden" th:field="*{id}" th:class="${'form-control' + (#fields.hasErrors('id') ? ' is-invalid' : '')}"/>
        <div class="form-group">
            <label for="summary">Summary</label>
            <input type="text" th:field="*{summary}" th:class="${'form-control' + (#fields.hasErrors('summary') ? ' is-invalid' : '')}"/>
        </div>
        <div class="form-group">
            <label for="text">Message</label>
            <textarea th:field="*{text}" th:class="${'form-control' + (#fields.hasErrors('text') ? ' is-invalid' : '')}"></textarea>
        </div>
        <div class="form-group">
            <label >性别<span>&nbsp;Sex:</span></label>
            <select th:field="*{gender}" class="form-control"
                    data-required="true">
                <option value="男" th:text="'男'" th:selected="selected" >男</option>
                <option value="女" th:text="'女'" th:selected="selected" >女</option>
                <option value="">请选择</option>
            </select>
        </div>
        <div class="form-group">
            <label >今晚吃鸡<span>&nbsp;Eat chicken:</span></label>
            <ul>
                <li class="fl">
                    <input type="radio" name="enableFlag"   th:checked="${message.enableFlag== true}" value="true" style="margin: 10px;"/>
                    <label class="iRadioLable" style="width:auto; max-width:auto;margin: 0">是</label>
                </li>
                <li class="fl">
                    <input type="radio" name="enableFlag" th:checked="${message.enableFlag==false}" value="false" style="margin: 10px"/>
                    <label class="iRadioLable" style="width:auto; max-width:auto;margin: 0">否</label>
                </li>
            </ul>
        </div>
        <button type="submit" class="btn btn-primary">Submit</button>
    </form>
</div>
</body>
</html>